package com.dmwork.service.interaction.controller.front.feign;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.dmwork.service.interaction.entity.WorkCollect;
import com.dmwork.service.interaction.service.WorkCollectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@Api(description = "收藏服务远程调用接口")
@RestController
@RequestMapping("/front/dm_work/interaction/collect/feign")
public class FrontFeignWorkCollectController {

    @Autowired
    private WorkCollectService workCollectService;

    @ApiOperation("获取作品的被收藏数")
    @GetMapping("get_collect_count_by_work_id/{workId}")
    public Integer getCollectCountByWorkId(@PathVariable("workId") String workId) {
        return workCollectService.getCollectCountByWorkId(workId);
    }

    @ApiOperation("批量获取多个作品的被收藏数")
    @GetMapping("get_batch_collect_count_by_work_id")
    public Map<String, Integer> getBatchCollectCountByWorkIdList(@RequestParam("workIdList") List<String> workIdList) {
        return workCollectService.getBatchCollectCountByWorkIdList(workIdList);
    }

    @ApiOperation("获取指定用户的作品收藏数")
    @GetMapping("get_collect_count_by_customer_id/{customerId}")
    public Integer getCollectCountByCustomerId(@PathVariable String customerId) {
        return workCollectService.getCollectCountByCustomerId(customerId);
    }

}
